package com.mitgroup.dmrvs.adapter;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class SpinnerAdapter extends ArrayAdapter<String> {  
    Context context;  
    List<String>  dataList;
  
   public SpinnerAdapter(final Context context,  
            final int textViewResourceId, final  List<String> objects) {  
        super(context, textViewResourceId, objects);  
        this.dataList = objects;  
        this.context = context;  
    }  
  
    @Override  
    public View getDropDownView(int position, View convertView,  
            ViewGroup parent) {  
  
        if (convertView == null) {  
            LayoutInflater inflater = LayoutInflater.from(context);  
            convertView = inflater.inflate(  
                    android.R.layout.simple_spinner_item, parent, false);  
        }  
  
        TextView tv = (TextView) convertView  
                .findViewById(android.R.id.text1);  
        tv.setText(dataList.get(position)); 
       tv.setGravity(Gravity.CENTER); 
        tv.setTextColor(Color.parseColor("#888888"));  
        tv.setTextSize(15);  
        return convertView;  
    }  
  
    @Override  
    public View getView(int position, View convertView, ViewGroup parent) {  
        if (convertView == null) {  
            LayoutInflater inflater = LayoutInflater.from(context);  
            convertView = inflater.inflate(  
                    android.R.layout.simple_spinner_item, parent, false);  
        }  
  
        TextView tv = (TextView) convertView  
                .findViewById(android.R.id.text1);  
        tv.setText(dataList.get(position)); 
       tv.setGravity(Gravity.CENTER); 
       tv.setTextColor(Color.parseColor("#888888"));
        tv.setTextSize(15);  
        return convertView;  
    }  
}
